package com.game.framework.dao;

import com.game.framework.dao.entity.AccountEntity;
import com.game.framework.dao.redis.EnumRedisKey;
import com.game.framework.dao.redis.IRedisKeyConfig;
import com.game.framework.dao.repository.AccountRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Service;

@Service
public class AccountDao extends AbstractDao<AccountEntity, Long> {

	@Autowired
	protected AccountRepository accountRepository;

	@Override
	protected IRedisKeyConfig getRedisKey() {
		return EnumRedisKey.Account;
	}

	@Override
	protected MongoRepository<AccountEntity, Long> getMongoRepository() {
		return accountRepository;
	}

	@Override
	protected Class<AccountEntity> getEntityClass() {
		return AccountEntity.class;
	}
	
	public AccountEntity selectByAccount(String account) {
		return accountRepository.findByAccount(account);
	}

}
